package com.enba.mallapi.module.user;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.enba.boot.core.base.Result;
import com.enba.mall.core.users.user.entity.User;
import com.enba.mall.core.users.user.service.IUserService;
import io.swagger.annotations.Api;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;

@Api(tags = "用户管理")
@RestController
@RequestMapping("/api/user")
public class PlatformUserController {

  @Resource private IUserService userService;

  /**
   * 分页查询接口
   *
   * @param pageNum nume
   * @param pageSize size
   * @return result
   */
  @GetMapping("/page")
  public Result<Page<User>> findPage(
      @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
    QueryWrapper<User> queryWrapper = new QueryWrapper<>();
    return Result.success(userService.page(new Page<>(pageNum, pageSize), queryWrapper));
  }
}
